<template>
      <component @onConfirm="onConfirm" :onSearch="onSearch" :is="componentId" :ruleForm="ruleForm" :data="data" v-if="componentId"></component>
</template>
<script lang="ts">
import { Component, Vue,Prop,Emit} from 'vue-property-decorator';
@Component({
     components:{},
})
export default class UserList extends Vue {
     @Prop() private data!: any;
     @Prop() private type!: any;
     @Prop() private onSearch:any;
     @Prop() private ruleForm!:any;
     public componentId:any={};
     public get loader(){
          if(!this.type){
              return null;
          }
          return ()=>import(`./template/${this.type}/index.vue`);
     }
     //动态加载组件
     created(){
          this.componentId=()=>this.loader();
     }
     @Emit("onConfirm")
     private onConfirm(params:any){
          return params;
     }
}
</script>
